diff options
Diffstat (limited to 'app/[lng]/evcp/(evcp)/report/page.tsx')
| -rw-r--r-- | app/[lng]/evcp/(evcp)/report/page.tsx | 69 |
1 files changed, 22 insertions, 47 deletions
diff --git a/app/[lng]/evcp/(evcp)/report/page.tsx b/app/[lng]/evcp/(evcp)/report/page.tsx index f84ebe52..a538b37c 100644 --- a/app/[lng]/evcp/(evcp)/report/page.tsx +++ b/app/[lng]/evcp/(evcp)/report/page.tsx @@ -1,31 +1,38 @@ -// app/procurement/dashboard/page.tsx import * as React from "react"; import { Skeleton } from "@/components/ui/skeleton"; import { Shell } from "@/components/shell"; import { ErrorBoundary } from "@/components/error-boundary"; -import { getDashboardData, refreshDashboardData } from "@/lib/dashboard/service"; +import { getDashboardData } from "@/lib/dashboard/service"; import { DashboardClient } from "@/lib/dashboard/dashboard-client"; -export const dynamic = 'force-dynamic'; // ① 동적 페이지 선언 - -// 대시보드 데이터 로딩 컴포넌트 -async function DashboardContent() { +export default async function IndexPage() { + // domain을 명시적으로 전달 + const domain = "evcp"; + try { - const data = await getDashboardData("evcp"); - + // 서버에서 직접 데이터 fetch + const dashboardData = await getDashboardData(domain); + return ( - <DashboardClient - initialData={data} - onRefresh={refreshDashboardData} - /> + <Shell className="gap-2"> + <DashboardClient initialData={dashboardData} /> + </Shell> ); } catch (error) { - console.error("Dashboard data loading error:", error); - throw error; + console.error("Dashboard data fetch error:", error); + return ( + <Shell className="gap-2"> + <div className="flex items-center justify-center py-12"> + <div className="text-center space-y-2"> + <p className="text-destructive">데이터를 불러오는데 실패했습니다.</p> + <p className="text-muted-foregroucdnd text-sm">{error instanceof Error ? error.message : "알 수 없는 오류가 발생했습니다."}</p> + </div> + </div> + </Shell> + ); } } -// 대시보드 로딩 스켈레톤 function DashboardSkeleton() { return ( <div className="space-y-6"> @@ -91,35 +98,3 @@ function DashboardSkeleton() { </div> ); } - -// 에러 표시 컴포넌트 -function DashboardError({ error, reset }: { error: Error; reset: () => void }) { - return ( - <div className="flex flex-col items-center justify-center py-12 space-y-4"> - <div className="text-center space-y-2"> - <h3 className="text-lg font-semibold">대시보드를 불러올 수 없습니다</h3> - <p className="text-muted-foreground"> - {error.message || "알 수 없는 오류가 발생했습니다."} - </p> - </div> - <button - onClick={reset} - className="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90" - > - 다시 시도 - </button> - </div> - ); -} - -export default async function DashboardPage() { - return ( - <Shell className="gap-6"> - <ErrorBoundary fallback={DashboardError}> - <React.Suspense fallback={<DashboardSkeleton />}> - <DashboardContent /> - </React.Suspense> - </ErrorBoundary> - </Shell> - ); -}
\ No newline at end of file |
